#include <stdio.h>
#include <string.h>
#include <stdbool.h>

bool CheckPermutation(char* s1, char* s2){
	if (strlen(s1) != strlen(s2)){
		return false;       //如果s1,s2长度不一样直接返回false
	}
    
	int a = 0, b = 0;       //分别存放两字符串个字母ASCII码之和的值
	int arr[123] = { 0 };
	while (*s1){
		arr[*s1]++;
		a += *s1;
		s1++;
	}
	while (*s2){
		arr[*s2]++;
		b += *s2;
		s2++;
	}
	if (a != b){
		return false;
	}
	for (int i = 0; i < 123; i++){
		if (arr[i] & 1){       //当arr中有元素为奇数时说明不匹配
			return false;
		}
	}
	return true;
}

int main()
{
	char* s1 = "asvnpzurz", *s2 = "urzsapzvn" ;
	CheckPermutation(s1,s2);
	return 0;
}